package com.hall.items.ctrl.vo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.hall.items.aggr.MyEquipType;
import com.hall.items.aggr.MyPlayerWeaponPack;
import com.hall.items.aggr.MyWeapon;
import com.hall.items.aggr.MyWeaponLevel;
import com.hall.items.aggr.MyWeaponPackCombatValue;

import dml.game.weapon.aggr.EquipedWeapon;

public class MyPlayerWeaponPackVO {

	private String id;

	private String userId;

	private String packNum;

	private String combatValue;

	private List<MyWeaponPackItemVO> items = new ArrayList<>();

	public MyPlayerWeaponPackVO() {
	}

	public MyPlayerWeaponPackVO(MyPlayerWeaponPack pack,
			MyWeaponPackCombatValue packCombatValue,
			List<MyWeaponLevel> weaponLevels) {
		id = pack.getId().toString();
		userId = pack.getPlayerId().toString();
		packNum = pack.getPackNum() + "";
		combatValue = packCombatValue == null ? "" : packCombatValue.getValue()
				+ "";
		Map<Long, MyWeaponLevel> weaponLevelsMap = new HashMap<>();
		for (MyWeaponLevel myWeaponLevel : weaponLevels) {
			weaponLevelsMap.put(myWeaponLevel.getId(), myWeaponLevel);
		}
		for (EquipedWeapon<MyEquipType, MyWeapon> item : pack
				.getEquipedWeaponList()) {
			items.add(new MyWeaponPackItemVO(item, weaponLevelsMap.get(item
					.getWeapon().getId())));
		}
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getPackNum() {
		return packNum;
	}

	public void setPackNum(String packNum) {
		this.packNum = packNum;
	}

	public List<MyWeaponPackItemVO> getItems() {
		return items;
	}

	public void setItems(List<MyWeaponPackItemVO> items) {
		this.items = items;
	}

	public String getCombatValue() {
		return combatValue;
	}

	public void setCombatValue(String combatValue) {
		this.combatValue = combatValue;
	}

}
